package com.ad.blogger.service.impl;


import com.ad.blogger.dao.IBloggerUserDAO;
import com.ad.blogger.service.IBloggerUserService;
import com.ad.common.entity.User;

public class BloggerUserServiceImpl implements IBloggerUserService{
	private IBloggerUserDAO bloggerUserDAO ;
	

	public IBloggerUserDAO getBloggerUserDAO() {
		return bloggerUserDAO;
	}

	public void setBloggerUserDAO(IBloggerUserDAO bloggerUserDAO) {
		this.bloggerUserDAO = bloggerUserDAO;
	}

	public User getUserByProperty(Integer id) {
		return null;
	}

	public User login(String username, String password,int userType) {
		return  this.bloggerUserDAO.query(username, password, userType);
	}

	public boolean register(User user) {
		return bloggerUserDAO.save(user);
	}
	public boolean isExist(String username){
		boolean b = false ;
		User user  = bloggerUserDAO.findByUsername(username);
		if(user!=null){
			b = true ;
		}
		
		return b ;
	}

	@Override
	public void edit(User user) {
		this.bloggerUserDAO.update(user);
		
	}
}
